<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery-3.2.1.min.js"></script>
    <script>
        function login() {
            $.post("/user/login",$("#f1").serialize(),function (info) {
                if(info == "ok"){
                    location.href="index.html";
                }else {
                    $("#loginInfo").html("登陆失败")
                }
            })
        }
    </script>
</head>
<body>
    <span id="loginInfo"></span>
    <form id="f1">
        用户名:<input type="text" name="userName"><br>
        密  码:<input type="text" name="pwd"><br>
        <input type="button" value="登陆" onclick="login()">
    </form>
</body>
</html>